/*
 * File:   virtual_functions.cpp
 * Author: tandaica0612
 *
 * Created on January 11, 2009, 5:23 PM
 */

#include <stdlib.h>
#include <iostream>
using namespace std;
class A{
public:
    virtual void inramanhinh(){
        cout << "This is class A" << endl;
    }
};
class C:public A{
public:
    virtual void inramanhinh(){
        cout << "This is class C" << endl;
    }
};
class B:public A{
public:
    void inramanhinh(){
        cout << "This is class B" << endl;
    }
};
class D:public B{
public:
    void inramanhinh(){
        cout << "This is class D" << endl;
    }
};
int main(int argc, char** argv) {
    A* a = new B();
    a->inramanhinh();
    //
    A* c = new C();
    c->inramanhinh();
    //
    B* b = new B();
    b->inramanhinh();
    //
    B* d = new D();
    d->inramanhinh();
    return (EXIT_SUCCESS);
}
/*
This is class B
This is class C
This is class B
This is class D
 * */

